|
|
|
|
|
|
|
Public Property Get CharAccept() As Integer
CharAccept = m_CharAccept
End Property
Public Property Let CharAccept(ByVal New_CharAccept As Integer)
m_CharAccept = New_CharAccept
PropertyChanged "CharAccept"
End Property |
|
|
|
|
|
|
|
|
Note that if you request any methods, the wizard creates them as functions instead of sub procedures. |
|
|
|
|
|
|
|
|
Finally, the code to read and write property values to the PropertyBag object is generated automatically. This code is as follows: |
|
|
|
|
|
|
|
|
'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
m_BackColor = PropBag.ReadProperty("BackColor", m_def_BackColor)
m_ForeColor = PropBag.ReadProperty("ForeColor", m_def_ForeColor)
txtCharset.Text = PropBag.ReadProperty("Text", "")
m_CharAccept = PropBag.ReadProperty("CharAccept", m_def_CharAccept)
End Sub
'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("BackColor", m_BackColor, m_def_BackColor)
Call PropBag.WriteProperty("ForeColor", m_ForeColor, m_def_ForeColor)
Call PropBag.WriteProperty("Text", txtCharset.Text, "")
Call PropBag.WriteProperty("CharAccept", m_CharAccept, m_def_CharAccept)
End Sub |
|
|
|
|
|
|
|
|
To complete the coding of your control, you need to add the custom code that is required for the CharAccept property and KeyPress event, shown in Listing 14.4. |
|
|
|
|
|
|
|
|
Listing 14.4 LIMITED.ZIPChanges to the Code Generated by the Wizard |
|
|
|
|
|
|
|
|
Public Property Get CharAccept() As Integer
CharAccept = mCharAccept
End Property
Public Property Let CharAccept(ByVal nNewValue As Integer)
Select Case nNewValue
Case 1 To 2
mCharAccept = nNewValue
Case Else
mCharAccept = 0
End Select
PropertyChanged "CharAccept"
End Property
Private Sub txtCharSet_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then Exit Sub |
|
|
|
|
|